package com.yoshino.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yoshino
 **/
public class College extends OrganizationComponent{

    // 存放Department
    List<OrganizationComponent> organizationComponents = new ArrayList<>();

    public College(String name, String des) {
        super(name, des);
    }

    // 重写add
    //将来实际业务中，Colleage的add和University add不一定完全一样
    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponents.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponents.remove(organizationComponent);
    }

    @Override
    protected void print() {
        System.out.println("--------------" + getName() + "------------------");
        for (OrganizationComponent oc : organizationComponents) {
            oc.print();
        }
    }
}
